﻿//  Copyright (c) 2011 Ray Liang (http://www.dotnetage.com)
//  Licensed MIT: http://www.opensource.org/licenses/mit-license.php

using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace DNA.Mvc
{
    [PropertiesMustMatch("NewPassword", "ConfirmPassword", ErrorMessageResourceName = "RegisterModel_PasswordMustBeMatch",        ErrorMessageResourceType = typeof(Resources.language))]
    public class ChangePasswordModel
    {
        [Required]
        [DataType(DataType.Password)]
        [DisplayName("Old password")]
        public string OldPassword { get; set; }

        [Required]
        [ValidatePasswordLength]
        [DataType(DataType.Password)]
        [DisplayName("New password")]
        public string NewPassword { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [DisplayName("Confirm password")]
        public string ConfirmPassword { get; set; }
    }

    public class LogOnModel
    {
        [Required(AllowEmptyStrings = false, ErrorMessageResourceType = typeof(Resources.language), ErrorMessageResourceName = "LogOnModel_UserNameRequried")]
        [DisplayName("User name")]
        public string UserName { get; set; }

        [Required(ErrorMessageResourceType = typeof(Resources.language), ErrorMessageResourceName = "LogOnModel_PasswordRequried")]
        [DataType(DataType.Password)]
        [DisplayName("Password")]
        public string Password { get; set; }

        [DisplayName("Remember me?")]
        public bool RememberMe { get; set; }
    }

    [PropertiesMustMatch("Password", "ConfirmPassword", ErrorMessageResourceName = "RegisterModel_PasswordMustBeMatch", ErrorMessageResourceType = typeof(Resources.language))]
    public class RegisterModel
    {
        [Required(AllowEmptyStrings = false, ErrorMessageResourceType = typeof(Resources.language), ErrorMessageResourceName = "LogOnModel_UserNameRequried")]
        [StringLength(20, MinimumLength = 4, ErrorMessageResourceName = "RegisterModel_UserNameLength", ErrorMessageResourceType = typeof(Resources.language))]
        [DisplayName("User name")]
        public string UserName { get; set; }

        [Required]
        [DataType(DataType.EmailAddress, ErrorMessageResourceType = typeof(Resources.language), ErrorMessageResourceName = "RegisterModel_EMailIncorrect")]
        [DisplayName("Email")]
        public string Email { get; set; }

        [Required(ErrorMessageResourceType = typeof(Resources.language), ErrorMessageResourceName = "LogOnModel_PasswordRequried")]
        [ValidatePasswordLength]
        [DataType(DataType.Password)]
        [DisplayName("Password")]
        public string Password { get; set; }

        [Required(ErrorMessageResourceType = typeof(Resources.language), ErrorMessageResourceName = "RegisterModel_ConfirmPasswordRequired")]
        [DataType(DataType.Password)]
        [DisplayName("Confirm password")]
        public string ConfirmPassword { get; set; }
    }

}
